import Vuex from 'vuex'
import login from './modules/login.js'

const store = new Vuex.Store({
	state: {
		gateway: "https://chat.wokahui.com",
		loading: 0, // loading遮罩
		shadow: 0, // popup遮罩,或禁止页面级响应
	},
	mutations: {
		showLoading(state) {
			state.loading++;
		},
		hideLoading(state) {
			if (state.loading > 0) setTimeout(() => state.loading--);
		},
		showShadow(state, payload) {
			state.shadow++;
		},
		hideShadow(state, payload) {
			if (state.shadow > 0) setTimeout(() => state.shadow--);
		},
	},
	modules: {
		login
	}
})

export default store